package com.nuc.thread.status;

import lombok.extern.slf4j.Slf4j;

/**
 * @Description
 * @Author 诗酒趁年华
 * @Version V1.0.0
 * @Date 2021/5/5
 */
@Slf4j
public class InterruptTest1 {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            try {
                Thread.sleep(2000);
                log.debug("running");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        log.debug("interrupt");
        thread.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        thread.interrupt();
        log.debug("打断标识{}",thread.isInterrupted());
    }
}
